<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/sinopac-fn" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>TOKEN 入庫</title>
	<link rel="stylesheet" href="${fn:url('/form/CSS/tabs.css')}">
	<script type="text/javascript" src="${fn:url('/js/jQuery/jquery-1.8.2.min.js')}"></script>
	<script type="text/javascript" src="${fn:url('/js/jQuery/jquery_DOMWindow.js')}"></script>
	<script type="text/javascript" src="${fn:url('/js/tools/formUtil.js')}"></script>
	<script>
		$(document).ready(function(){
			$('input[name=btnOK]').click(function(){
				var f = $('#upload');
				f.prop('action','${fn:url('/TokenStorage/uploadFile.action')}');
				f.submit();
			});
			$('input[name=btnCancel]').click(function(){
				var f = $('#upload');
				f.prop('action','${fn:url('/TokenStorage/backMain.action')}');
				f.submit();
			});
			if(<s:property value="successFlag"/>){
				alert('上傳成功');
				var f = $('#upload');
				f.prop('action','${fn:url('/TokenStorage/backMain.action')}');
				f.submit();
			}
		});
	</script>
</head>
<body>
	<div align="center">
	<%@ include file="/form/include/title.jsp" %>
	<fieldset style="width: 400px">
		<s:form id="upload" method="POST" enctype="multipart/form-data" validate="true">
			<table width="300">
				<tr>
					<td>目前系統庫存</td>
				</tr>
				<tr>
					<td>總計有TOKEN <font color="red"><s:property value="tokenVO.total_cnt"/></font> 支</td>
				</tr>
				<tr>
					<td>已配發 <font color="red"><s:property value="tokenVO.allotted_cnt"/></font> 支</td>
				</tr>
				<tr>
					<td>已註銷 <font color="red"><s:property value="tokenVO.block_cnt"/></font> 支</td>
				</tr>
				<tr>
					<td>未配發 <font color="red"><s:property value="tokenVO.notAllotted_cnt"/></font> 支</td>
					<td style="display: none;">
						<input type="hidden" name="tokenVO.total_cnt" value="${tokenVO.total_cnt}"/>
						<input type="hidden" name="tokenVO.allotted_cnt" value="${tokenVO.allotted_cnt}"/>
						<input type="hidden" name="tokenVO.block_cnt" value="${tokenVO.block_cnt}"/>
						<input type="hidden" name="tokenVO.notAllotted_cnt" value="${tokenVO.notAllotted_cnt}"/>
					</td>
				</tr>
			</table>
			<s:label value="讀入檔案"/><s:file name="file"/>
			<table>
				<tr>
					<td><s:submit value="確定" method="uploadFile" theme="simple"></s:submit></td>
					<td><input type="button" value="取消" name="btnCancel"></td>
				</tr>
			</table>
		</s:form>
	</fieldset>
	<font color="red">
		<s:fielderror fieldName="error_msg" theme="simple"/>
	</font>
	</div>
</body>
</html>